import 'package:flutter/cupertino.dart';
import 'package:kq_flutter_core_widget/utils/kq_screen_util.dart';

///机器详情页面子页面均分弹出抽屉通用样式
class DrawerView extends StatelessWidget {
  ///左测偏移距离，默认160.r
  final double? offset;

  ///界面宽度，不设置时会用（屏幕宽度-左测偏移距离）/2
  final double? widgetWidth;

  ///子界面
  final Widget child;

  const DrawerView({
    super.key,
    this.offset,
    this.widgetWidth,
    required this.child,
  });

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: widgetWidth ??
          (MediaQuery.of(context).size.width - (offset ?? 160.r)) / 2,
      height: double.infinity,
      child: child,
    );
  }
}
